package regexobject;
/**
 * boolean matches(String regex)
 * */
public class MatchesDemo {
    public static void main(String[] args) {
        //mail regex:  [a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
        //I guess the regex is equal to:[\w]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
//        String email="wangtc@tedu.com";
//        String emailRegex="[\\w]+[@][a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
//        boolean result=email.matches(emailRegex);
//        if(result){
//            System.out.println("Is the correct mail format");
//        }else{
//            System.out.println("Isn't the correct mail format");
//        }
//        String line="我艹";
//        line=line.replaceAll("[艹]+","*");
//        System.out.println(line);
String line="barbarian uncivilized uncultivated unenlightened";
line=line.replaceAll("(barbarian)","*");
        System.out.println(line);
    }
}
